<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    // 当一个嵌套的内部(子)函数引用了嵌套的外部(父)函数的变量(函数)时, 就产生了闭包.
    function fn(){
        let a = 1;
        return function(){
            console.log(++a);
        }
    }
    const my = fn();
    my();
    my();
    my();
    my();
    my();

</script>
</html>